<?php

function jsonToDate($format, $jsonDateObject) {
    $matches = array();
    preg_match('/([\d]{10})/', $jsonDateObject, $matches);
    return date($format, $matches[0]);
}

function dateToJson($date) {
    $timestamp = strtotime($date);
    $jsonDate = "/Date(" . $timestamp . "-0500)/";
    return $jsonDate;
}

?>
